<?php

namespace Biz\Requests\Site;

use Illuminate\Validation\Rule;
use Biz\Constants\Site\SiteMailConstants;
use Lumen\Validation\Validators\RequestValidator;

/**
 * SiteMailRequest.
 *
 * @license [http://www.85do.com] [杭州永奥网络科技有限公司]
 * @copyright Copyright (c) 2018-2026 Hangzhou Yongao Technology Co., Ltd. All rights reserved.
 */
class SiteMailRequest extends RequestValidator
{
    /**
     * Get custom rules for validator errors.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'driver'                       => [
                'required',
                Rule::in(SiteMailConstants::$Drivers),
                'max:16',
            ],
            'host'                             => 'required|string|max:255',
            'port'                             => 'required|integer|max:999999',
            'from'                             => 'required|array|max:2',
            'from.name'                        => 'required|max:255',
            'from.address'                     => 'required|email|max:255',
            'encryption'                       => [
                'required',
                Rule::in(SiteMailConstants::$Encryptions),
                'max:16',
            ],
            'username'                           => 'required|email|max:255',
            'password'                           => 'required|string|max:255',
        ];
    }
}
